import { ipcMain, BrowserWindow } from "electron";
import { OperateType } from "../types/types.ts";
/**监听登录事件 */
ipcMain.on("login", () => {
  let win = BrowserWindow.getFocusedWindow();
  win?.setResizable(true);
  // 设置最小尺寸，等待改进
  win?.setSize(1000, 600, true);
  win?.setMinimumSize(1000, 600);
  win?.setBackgroundColor("#fff");
});
/** 监听登录窗口操作函数*/
ipcMain.on("operate-login-window", (_event, type: OperateType) => {
  let win = BrowserWindow.getFocusedWindow();
  switch (type) {
    case OperateType.Close:
      win?.close();
      break;
    case OperateType.Mini:
      win?.minimize();
      break;
    case OperateType.Max:
      win?.maximize();
      break;
    case OperateType.Normal:
      win?.restore();
      break;
    default:
      break;
  }
});
